package usedForPage;

import java.util.HashMap;
import java.util.HashSet;

public class MapChar {

	private static HashMap<Character, HashSet<Character>> hmCharStSameSound = null;
	private static HashMap<Character, HashSet<Character>> hmCharStAdjacent = null;

	public static HashMap<Character, HashSet<Character>> getHmCharStSameSound() {
		if (hmCharStSameSound == null) {
			createSameSound();
		}
		return hmCharStSameSound;
	}
	
	public static HashMap<Character, HashSet<Character>> getHmCharStAdjacent() {
		if (hmCharStAdjacent == null) {
			createAdjacent();
		}
		return hmCharStAdjacent;
	}

	private static void createSameSound() {
		hmCharStSameSound = new HashMap<Character, HashSet<Character>>();
		HashSet<Character> stTemp = new HashSet<Character>();
		stTemp.add('a');
		stTemp.add('e');
		stTemp.add('i');
		stTemp.add('u');
		stTemp.add('o');
		hmCharStSameSound.put('a', stTemp);
		hmCharStSameSound.put('e', stTemp);
		hmCharStSameSound.put('i', stTemp);
		hmCharStSameSound.put('o', stTemp);
		hmCharStSameSound.put('u', stTemp);
		
		stTemp = new HashSet<Character>();
		stTemp.add('c');
		stTemp.add('k');
		hmCharStSameSound.put('c', stTemp);
		hmCharStSameSound.put('k', stTemp);
		
		stTemp = new HashSet<Character>();
		stTemp.add('t');
		stTemp.add('d');
		hmCharStSameSound.put('t', stTemp);
		hmCharStSameSound.put('d', stTemp);
		
		stTemp = new HashSet<Character>();
		stTemp.add('z');
		stTemp.add('x');
		stTemp.add('s');
		hmCharStSameSound.put('s', stTemp);
		hmCharStSameSound.put('z', stTemp);
		hmCharStSameSound.put('x', stTemp);
		
		
		stTemp = new HashSet<Character>();
		stTemp.add('j');
		stTemp.add('g');
		hmCharStSameSound.put('j', stTemp);
		hmCharStSameSound.put('g', stTemp);
		
		stTemp = new HashSet<Character>();
		stTemp.add('m');
		stTemp.add('n');
		hmCharStSameSound.put('n', stTemp);
		hmCharStSameSound.put('m', stTemp);

	}

	private static void createAdjacent() {
		hmCharStAdjacent = new HashMap<Character, HashSet<Character>>();

		HashSet<Character> stTemp = new HashSet<Character>();
		stTemp.add('q');
		stTemp.add('w');
		stTemp.add('s');
		stTemp.add('z');
		hmCharStSameSound.put('a', stTemp);
		
		stTemp = new HashSet<Character>();
		stTemp.add('a');
		stTemp.add('w');
		stTemp.add('s');
		hmCharStSameSound.put('q', stTemp);
		
		stTemp = new HashSet<Character>();
		stTemp.add('q');
		stTemp.add('a');
		stTemp.add('s');
		stTemp.add('e');
		hmCharStSameSound.put('w', stTemp);
		
		stTemp = new HashSet<Character>();
		stTemp.add('w');
		stTemp.add('s');
		stTemp.add('d');
		stTemp.add('r');
		hmCharStSameSound.put('e', stTemp);
		
		stTemp = new HashSet<Character>();
		stTemp.add('e');
		stTemp.add('d');
		stTemp.add('f');
		stTemp.add('t');
		hmCharStSameSound.put('r', stTemp);
		
		stTemp = new HashSet<Character>();
		stTemp.add('r');
		stTemp.add('f');
		stTemp.add('g');
		stTemp.add('y');
		hmCharStSameSound.put('t', stTemp);
		
		stTemp = new HashSet<Character>();
		stTemp.add('t');
		stTemp.add('g');
		stTemp.add('h');
		stTemp.add('u');
		hmCharStSameSound.put('y', stTemp);
		
		stTemp = new HashSet<Character>();
		stTemp.add('y');
		stTemp.add('h');
		stTemp.add('j');
		stTemp.add('i');
		hmCharStSameSound.put('u', stTemp);
	}

}
